-
Notifications
You must be signed in to change notification settings - Fork 822
Add Cpp Doc Generate tools #5900
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
感谢你贡献飞桨文档,文档预览构建中,Docs-New 跑完后即可预览,预览链接:http://preview-pr-5900.paddle-docs-preview.paddlepaddle.org.cn/documentation/docs/zh/api/index_cn.html |
❌ The PR's message can't be empty. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
几处小问题已 comment~目前代码里有多处 TODO,最好检查下是否真的是 TODO 项点,并且尽快解决~~如果只是出于后续扩展考虑,可以写成 Note~
ci_scripts/CAPItools/main.py
Outdated
# TODO 通过已安装的 paddle 来查找 include | ||
# import paddle | ||
# import inspect | ||
# | ||
# # 获取已安装paddle的路径 | ||
# print(os.path.dirname(inspect.getsourcefile(paddle))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个功能挺好的,避免重复安装 paddle,后续会跟进吗?现在解析 rst 的逻辑是,每次解析前要都要执行下安装 paddle 的命令吗?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个目前是手动导入.h
文件, 在设计时有讨论到看看是否能在ci中预留PR-CI-Build
或者PR-CI-Py3
编译后的包(因为在生成文档时编译整个项目其实有点浪费资源)
同时我们引入了另一个解决方案, 在运行时带参数
python main.py [source dir] [target dir]
python main.py ../paddle .
if __name__ == "__main__":
if len(sys.argv) == 3:
root_dir = sys.argv[1]
save_dir = sys.argv[2]
else:
# for simple run
root_dir = '../paddle'
save_dir = '.'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
看看是否能在ci中预留
PR-CI-Build
或者PR-CI-Py3
编译后的包(因为在生成文档时编译整个项目其实有点浪费资源)
官网展示应该不要求这么高的实效性,根据 nightly build 包解析应该就行。
此处疑惑的点在于,paddle doc 生成 python API 英文文档的时候,应该已经安装了一次 paddle 的包,是否能复用这个包的路径。如果没办法复用的话,要在脚本里运行 安装 paddle 的命令吗?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, 等 @Liyulingyue 更新
现在的优先级是参数
->已安装的paddle环境
->同目录下的paddle
ci_scripts/CAPItools/main.py
Outdated
# TODO 需要单独处理一下这种 | ||
""" | ||
#if defined(PADDLE_WITH_CUDA) || defined(PADDLE_WITH_HIP) | ||
/** | ||
* Get the current CUDA stream for the passed CUDA device. | ||
*/ | ||
PADDLE_API phi::CUDAStream* GetCurrentCUDAStream(const phi::Place& place); | ||
#endif | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我没有看到,对这种 pattern 做了特殊匹配
如果 TODO 已经完成,可以更新下
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这边我们讨论了一下会在注释中处理, 解析是可以正常解析的, 就是说明一下只能在gpu环境下使用
|
||
|
||
# 获取方法中的参数parameters | ||
def get_parameters(parameters): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
提个小建议哈:每个函数上面的注释可以写的更详细些,对于降低后续的维护成本有很大帮助,尤其是对于这种解析文本类的函数,是不是可以在函数前面注释下,方便结合示例理解代码,比如:
解析前:***
解析后:***
ci_scripts/CAPItools/utils_helper.py
Outdated
else: | ||
print('Error language! ') | ||
|
||
def create_file_cn(self, save_dir, language): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个函数还包括写入文件的动作,函数名是否可以改为 create_and_write_file_cn
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
add codes for generating c++ files